/**
 * log4j日志文件读取初始化
 * 
 * 2013-04-28
 * */
package com.sys.utils;

import java.io.IOException;
import java.util.Properties;

import javax.servlet.http.HttpServlet;

import org.apache.log4j.PropertyConfigurator;

public class Log4jInit extends HttpServlet{
	
	private static final long serialVersionUID = 1L;

	public void init(){
		/**
		 * apache中的调用方法
		 * */
		String file = getInitParameter("log4j");
		System.out.println("=================================log4j start=================================");
		if(file != null){
			Properties ps = new Properties();
			try{
				ps.load(getServletContext().getResourceAsStream(file));
			}catch(IOException e){
				e.printStackTrace();
			}
			PropertyConfigurator.configure(ps);
		}
	}
	
}
